/*
* "$Id: config.h 408 2010-09-19 05:26:46Z mike $"
*
* Configuration file for Mini-XML, a small XML-like file parsing library.
*
* Copyright 2003-2010 by Michael R Sweet.
*
* These coded instructions, statements, and computer programs are the
* property of Michael R Sweet and are protected by Federal copyright
* law.  Distribution and use rights are outlined in the file "COPYING"
* which should have been included with this file.  If this file is
* missing or damaged, see the license at:
*
*     http://www.minixml.org/
*/
#ifndef __MXML_CONFIG_H
#define __MXML_CONFIG_H
/*
* Beginning with VC2005, Microsoft breaks ISO C and POSIX conformance
* by deprecating a number of functions in the name of security, even
* when many of the affected functions are otherwise completely secure.
* The _CRT_SECURE_NO_DEPRECATE definition ensures that we won't get
* warnings from their use...
*
* Then Microsoft decided that they should ignore this in VC2008 and use
* yet another define (_CRT_SECURE_NO_WARNINGS) instead.  Bastards.
*/
#ifndef WIN32
#define WIN32 _WIN32
#endif

#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_WARNINGS


/*
* Include necessary headers...
*/
#include <dfs_posix.h>
// #include <stdio.h>
// #include <stdlib.h>
// #include <string.h>
// #include <stdarg.h>
// #include <ctype.h>
// #include <io.h>


/*
* Microsoft also renames the POSIX functions to _name, and introduces
* a broken compatibility layer using the original names.  As a result,
* random crashes can occur when, for example, strdup() allocates memory
* from a different heap than used by malloc() and free().
*
* To avoid moronic problems like this, we #define the POSIX function
* names to the corresponding non-standard Microsoft names.
*/

// #define close		_close
// #define open		_open
// #define read	    _read
// #define snprintf 	_snprintf
// #define strdup		_strdup
// #define vsnprintf 	_vsnprintf
// #define write		_write

#ifndef NULL
#define NULL RT_NULL
#endif
#ifndef EOF
#define EOF (-1)
#endif

// #define malloc	rt_malloc
// #define calloc	rt_calloc
// #define realloc	rt_realloc
// #define free	rt_free

#define snprintf 	rt_snprintf
#define memset	rt_memset
#define strlen	rt_strlen
#define strncpy	rt_strncpy
#define strncmp	rt_strncmp

/*
* Version number...
*/

#define MXML_VERSION "Mini-XML v2.7"


/*
* Inline function support...
*/
#ifndef inline
	#define inline _inline
#endif

/*
* Long long support...
*/

#define HAVE_LONG_LONG 1


/*
* Do we have the snprintf() and vsnprintf() functions?
*/

// modified by jimmy.lee 20130709:
#define HAVE_SNPRINTF       1
#define HAVE_VSNPRINTF      1
// end modified.


/*
* Do we have the strXXX() functions?
*/

// modified by jimmy.lee 20130709:
#define HAVE_STRDUP         1
// end modified.


/*
* Define prototypes for string functions as needed...
*/

#  ifndef HAVE_STRDUP
extern char	*_mxml_strdup(const char *);
#    define strdup _mxml_strdup
#  endif /* !HAVE_STRDUP */

extern char	*_mxml_strdupf(const char *, ...);
extern char	*_mxml_vstrdupf(const char *, va_list);

#  ifndef HAVE_SNPRINTF
extern int	_mxml_snprintf(char *, size_t, const char *, ...);
#    define snprintf _mxml_snprintf
#  endif /* !HAVE_SNPRINTF */

#  ifndef HAVE_VSNPRINTF
extern int	_mxml_vsnprintf(char *, size_t, const char *, va_list);
#    define vsnprintf _mxml_vsnprintf
#  endif /* !HAVE_VSNPRINTF */



#endif /* __MXML_CONFIG_H */
/*
* End of "$Id: config.h 408 2010-09-19 05:26:46Z mike $".
*/
